package com.pagoda.nerp.web.repositories;

import com.pagoda.nerp.web.entities.HRORGPost;
import com.pagoda.nerp.web.entities.HRUnit;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.util.List;
import java.util.Set;

@Transactional
public interface HRORGPostDao extends JpaRepository<HRORGPost,String> {

    @Query(value = "select * from hrpost hrposttable WHERE hrposttable.canonicalcode LIKE ?1% order by length(hrposttable.canonicalcode),hrposttable.canonicalcode",nativeQuery = true)
    public List<HRORGPost> findData(String rootcode);

    @Query(value = "select jobtitlecode from hrpost Where hrpost.postid LIKE ?1%",nativeQuery = true)
    public Set<String> getJobtitlecode(String postid);

    public HRORGPost findByJobtitlecode(String code);

    public List<HRORGPost> findBySuppostid(String suppostid);
}
